/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Menus;

import Control.ButtonController;
import Control.GameController;
import UserInterface.Button;
import gleem.linalg.Vec4f;
import java.util.TreeMap;

/**
 * Menu principal
 * @author Gustavo Buzogany Eboli
 */
public class MainMenu extends Menu {

    TreeMap saves;

    public MainMenu(GameController gc)
    {
        super(gc);

        int i = 0;

        saves = gc.getSm().getListaSaves();
        
        Button novoJogo = new Button("newGame",412, 400, 200, 30, "New Game");
        novoJogo.setColor(new Vec4f(0.3f, 0.3f, 1.0f, 1.0f));

        Button carregarJogo = null;

        if(saves.size() != 0)
        {
            carregarJogo = new Button("loadGame",412, 450, 200, 30, "Load Game");
            carregarJogo.setColor(new Vec4f(0.3f, 0.3f, 1.0f, 1.0f));
            i = 1;
        }

        Button ranking = new Button("highscore", 412, 450+i*50, 200, 30, "Highscore");
        ranking.setColor(new Vec4f(0.3f, 0.3f, 1.0f, 1.0f));

        Button sair = new Button("exit",412, 500+i*50, 200, 30, "Exit");
        sair.setColor(new Vec4f(0.3f, 0.3f, 1.0f, 1.0f));

        buttonList.add(novoJogo);
        buttonList.add(ranking);
        buttonList.add(sair);

        ButtonController bc = new ButtonController(gc);
        
        novoJogo.addButtonListener(bc);

        if(saves.size() != 0)
        {
            buttonList.add(carregarJogo);
            carregarJogo.addButtonListener(bc);
        }
        
        ranking.addButtonListener(bc);
        sair.addButtonListener(bc);
    }
}
